package com.iha.pongzor.gui;

import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapController;
import com.google.android.maps.MapView;
import com.google.android.maps.MapView.LayoutParams;
import android.view.View;
import android.widget.LinearLayout;
import com.iha.pongzor.R;

import android.os.Bundle;

public class Map extends MapActivity {

	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.map);

		MapView mapView = (MapView) findViewById(R.id.map_view);
		mapView.setStreetView(true);
		LinearLayout zoomLayout = (LinearLayout) findViewById(R.id.map_zoom);
		
		@SuppressWarnings("deprecation")
		View zoomView = mapView.getZoomControls();

		zoomLayout.addView(zoomView, new LinearLayout.LayoutParams(
				LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
		mapView.displayZoomControls(true);

		MapController mc = mapView.getController();
		String coordinates[] = {
				"56.171857", "10.190839"};
		double lat = Double.parseDouble(coordinates[0]);
		double lng = Double.parseDouble(coordinates[1]);
		
		GeoPoint point = new GeoPoint((int) (lat * 1E6), (int) (lng * 1E6));
		
		mc.animateTo(point);
		mc.setZoom(17);
		mapView.invalidate();
		
	}

	@Override
	protected boolean isRouteDisplayed() {
		return false;
	}
}
